import { request } from './client'
import type { LoginRequest, RegisterRequest, AuthResponse, User, UpdateProfileRequest } from '@/types/auth'

// 用户注册
export const register = (data: RegisterRequest) => {
  return request.post<AuthResponse>('/auth/register', data)
}

// 用户登录
export const login = (data: LoginRequest) => {
  return request.post<AuthResponse>('/auth/login', data)
}

// 获取当前用户信息
export const getCurrentUser = () => {
  return request.get<User>('/auth/me')
}

// 更新用户资料
export const updateProfile = (data: UpdateProfileRequest) => {
  return request.put<User>('/auth/profile', data)
}

// 验证token
export const verifyToken = () => {
  return request.get('/auth/verify')
}